<?php


namespace App\Http\Requests;
use App\Validate\BaseValidate;
class UsersRequests extends BaseValidate
{
    //验证规则
    protected $rule =[
        'phone' => 'required|unique:users',
        'phone' => 'regex:/^1[345789][0-9]{9}$/',
        'password' => 'required',
        'password1' => 'required',
        'password_confirmation' => 'required|same:password',
        'type' => 'required',
        'name' => 'required ',
        'avatar' => 'required ',
        'code' => 'required',

    ];
    /**
     * @var array
     * 验证提示
     */
    protected $message = [
        'phone.required'=>'请输入手机号码',
        'phone.regex'=>'手机号码格式不正确',
        'phone.unique'=>'该手机已注册',
        'password.required' =>'密码必须',
        'password1.required' =>'原密码必须',
        'password_confirmation.required' =>'确认密码不能为空',
        'password_confirmation.same' =>'密码与确认密码不匹配',
        'code.required' => '验证码必须',
        'type.required' => 'Type必须',
    ];
    //自定义场景
    protected $scene = [
        'login'=>"phone,password,type",
        'code_login'=> ['phone','code','type'],
        'modification'=>"password,password_confirmation",
    ];
}